import java.io.File;
import java.io.IOException;

public class Demo5 {

    public static void main(String[] args) {
        File file = new File("./demo");
        File newFile = new File("./src/demo");
        boolean result = file.renameTo(newFile);
        System.out.println(result);
    }

    public static void main2(String[] args) throws IOException {
        File file = new File("./test.txt");//这个文件得存在
        file.createNewFile();
        File rename = new File("./demo");//这个文件不存在

        boolean result = file.renameTo(rename);
        System.out.println(result);
    }
    public static void main1(String[] args) {
        File file = new File("./test/111/222");
        System.out.println(file.isDirectory());
        System.out.println(file.mkdir());
        System.out.println(file.isDirectory());
        System.out.println(file.mkdirs());
        System.out.println(file.isDirectory());
    }
}
